import 'package:flutter/material.dart';

/*创建数据共享类*/
class HotGoodInherited extends InheritedWidget {
  final int page;

  int isFinishLoad;

  HotGoodInherited(
      { this.page, this.isFinishLoad, Widget child})
      : super(child: child);

  @override
  bool updateShouldNotify(HotGoodInherited oldWidget) {
    return oldWidget.page != page && oldWidget.isFinishLoad != isFinishLoad;
  }

  //定义一个便捷方法，方便子树中的widget获取共享数据
  static HotGoodInherited of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<HotGoodInherited>();
  }
}
